<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>weblogolib.Dirichlet</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="weblogolib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://code.google.com/p/weblogo/">WebLogo</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="weblogolib-module.html">Package&nbsp;weblogolib</a> ::
        Class&nbsp;Dirichlet
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="weblogolib.Dirichlet-class.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF CLASS DESCRIPTION =========== -->
<h2 class="class">Type Dirichlet</h2>

<pre class="base-tree">
<a href="__builtin__.object-class.html"><code>object</code></a> --+
         |
        <b>Dirichlet</b>
</pre><br />

<hr/>

<pre class="literalblock">
The Dirichlet probability distribution. The Dirichlet is a continuous 
multivariate probability distribution across non-negative unit length
vectors. In other words, the Dirichlet is a probability distribution of 
probability distributions. It is conjugate to the multinomial
distribution and is widely used in Bayesian statistics.

The Dirichlet probability distribution of order K-1 is 

 p(theta_1,...,theta_K) d theta_1 ... d theta_K = 
    (1/Z) prod_i=1,K theta_i^{alpha_i - 1} delta(1 -sum_i=1,K theta_i)

The normalization factor Z can be expressed in terms of gamma functions:

  Z = {prod_i=1,K Gamma(alpha_i)} / {Gamma( sum_i=1,K alpha_i)}  

The K constants, alpha_1,...,alpha_K, must be positive. The K parameters, 
theta_1,...,theta_K are nonnegative and sum to 1.

Status:
    Alpha
</pre>
<hr/>


<!-- =========== START OF METHOD SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Method Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="weblogolib.Dirichlet-class.html#__init__" class="summary-sig-name"><code>__init__</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>alpha</span>)</span></code>
<br />
Args:
    - alpha  -- The parameters of the Dirichlet prior distribution.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="covariance"></a><span class="summary-sig"><span class="summary-sig-name">covariance</span>(<span class=summary-sig-arg>self</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="interval_relative_entropy"></a><span class="summary-sig"><span class="summary-sig-name">interval_relative_entropy</span>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>pvec</span>,
          <span class=summary-sig-arg>frac</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="mean"></a><span class="summary-sig"><span class="summary-sig-name">mean</span>(<span class=summary-sig-arg>self</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="weblogolib.Dirichlet-class.html#mean_entropy" class="summary-sig-name"><code>mean_entropy</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Calculate the average entropy of probabilities sampled
from this Dirichlet distribution.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="mean_relative_entropy"></a><span class="summary-sig"><span class="summary-sig-name">mean_relative_entropy</span>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>pvec</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="mean_x"></a><span class="summary-sig"><span class="summary-sig-name">mean_x</span>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>x</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="weblogolib.Dirichlet-class.html#sample" class="summary-sig-name"><code>sample</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Return a randomly generated probability vector.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="weblogolib.Dirichlet-class.html#variance_entropy" class="summary-sig-name"><code>variance_entropy</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Calculate the variance of the Dirichlet entropy.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="variance_relative_entropy"></a><span class="summary-sig"><span class="summary-sig-name">variance_relative_entropy</span>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>pvec</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="variance_x"></a><span class="summary-sig"><span class="summary-sig-name">variance_x</span>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>x</span>)</span></code>
</td></tr>
<tr bgcolor="#e8f0f8" class="group">
  <th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;Inherited from object</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__delattr__" class="summary-sig-name"><code>__delattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__delattr__('name') &lt;==&gt; del x.name...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__getattribute__" class="summary-sig-name"><code>__getattribute__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__getattribute__('name') &lt;==&gt; x.name...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__hash__" class="summary-sig-name"><code>__hash__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__hash__() &lt;==&gt; hash(x)...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__new__" class="summary-sig-name"><code>__new__</code></a>(<span class=summary-sig-arg>T</span>,
          <span class=summary-sig-arg>S</span>,
          <span class="summary-sig-vararg">...</span>)</span></code>
<br />
T.__new__(S, ...) -&gt; a new object with type S, a subtype of T...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce__" class="summary-sig-name"><code>__reduce__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce_ex__" class="summary-sig-name"><code>__reduce_ex__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__repr__" class="summary-sig-name"><code>__repr__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__repr__() &lt;==&gt; repr(x)...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__setattr__" class="summary-sig-name"><code>__setattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__setattr__('name', value) &lt;==&gt; x.name = value...</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__str__" class="summary-sig-name"><code>__str__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__str__() &lt;==&gt; str(x)...</td></tr>
</table><br />


<!-- =========== START OF CLASS VARIABLE SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Class Variable Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>tuple</code></font></td>
<td><b><a href="weblogolib.Dirichlet-class.html#__slots__"><code>__slots__</code></a></b> = <span title="('alpha', '_total', '_mean')"><code>('alpha',&nbsp;'_total',&nbsp;'_mean')                 </code>
</span></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>member_descriptor</code></font></td>
<td><b><a href="weblogolib.Dirichlet-class.html#alpha"><code>alpha</code></a></b> = <span title="&lt;member 'alpha' of 'Dirichlet' objects&gt;"><code>&lt;member&nbsp;'alpha'&nbsp;of&nbsp;'Dirichlet'&nbsp;objects&gt;          </code>
</span></td></tr>
</table><br />


<!-- =========== START OF METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Method Details</th></tr>
</table>

<a name="__init__"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">__init__</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>alpha</span>)</span>
    <br /><i>(Constructor)</i>
  </h3>
<pre class="literalblock">
Args:
    - alpha  -- The parameters of the Dirichlet prior distribution.
                A vector of non-negative real numbers.
</pre>
  <dl><dt></dt><dd>
    <dl><dt><b>Overrides:</b></dt>
      <dd><a href="__builtin__.object-class.html#__init__"><code>__builtin__.object.__init__</code></a></dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="mean_entropy"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">mean_entropy</span>(<span class=sig-arg>self</span>)</span>
  </h3>
<pre class="literalblock">
Calculate the average entropy of probabilities sampled
from this Dirichlet distribution. 

Returns:
    The average entropy.
    
Ref:
    Wolpert &amp; Wolf, PRE 53:6841-6854 (1996) Theorem 7
    (Warning: this paper contains typos.)
Status:
    Alpha
Authors:
    GEC 2005
</pre>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="sample"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">sample</span>(<span class=sig-arg>self</span>)</span>
  </h3>
<pre class="literalblock">
Return a randomly generated probability vector.

Random samples are generated by sampling K values from gamma
distributions with parameters a=lpha_i, b=1, and renormalizing. 

Ref:
    A.M. Law, W.D. Kelton, Simulation Modeling and Analysis (1991).
Authors:
    Gavin E. Crooks &lt;gec&#64;compbio.berkeley.edu&gt; (2002)
</pre>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="variance_entropy"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">variance_entropy</span>(<span class=sig-arg>self</span>)</span>
  </h3>
<pre class="literalblock">
Calculate the variance of the Dirichlet entropy. 

Ref:
    Wolpert &amp; Wolf, PRE 53:6841-6854 (1996) Theorem 8
    (Warning: this paper contains typos.)
</pre>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF CLASS VARIABLE DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Class Variable Details</th></tr>
</table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="__slots__"></a>
<h3>__slots__</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>tuple</code>

      </dd>
<span title="('alpha', '_total', '_mean')">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
('alpha', '_total', '_mean')                                           </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="alpha"></a>
<h3>alpha</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>member_descriptor</code>

      </dd>
<span title="&lt;member 'alpha' of 'Dirichlet' objects&gt;">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
&lt;member 'alpha' of 'Dirichlet' objects&gt;                                </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="weblogolib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://code.google.com/p/weblogo/">WebLogo</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on </font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>
